/*
 * 作者：姚俊
 * 功能：单人发送邮件action
 * 日期：2015-05-25
 */
package admin.action.mail;

import java.io.IOException;

import javax.mail.MessagingException;
import javax.mail.internet.AddressException;

import teacher.bean.Teacher;

import admin.email.SendEmail;
import admin.service.member.TeacherService;

public class MailAction {
	
	private String content;
	private String toUser;
	private String email;
	private String title;
	private int teaId;
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	
	public String getToUser() {
		return toUser;
	}
	public void setToUser(String toUser) {
		this.toUser = toUser;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	
	public int getTeaId() {
		return teaId;
	}
	public void setTeaId(int teaId) {
		this.teaId = teaId;
	}
	public String execute()
	{
		
		System.out.println("fdsafdsa"+this.getTeaId());
		Teacher tea=new Teacher();
		tea.setTeaId(teaId);
		Teacher tea1=new TeacherService().getTeacher(tea);
		
		System.out.println("主题为:"+this.getContent());
		System.out.println("内容为:"+this.getTitle());
		System.out.println("发送人为："+tea1.getMail());
		System.out.println("fdsafdsafsda我已经执行了");
		try {
			SendEmail.send_email(tea1.getMail(), this.getTitle(), this.getContent());
		} catch (AddressException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (MessagingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}	

}
